<?php if (!defined('THINK_PATH')) exit();?><!doctype html>
<html class="no-js">
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title><?php echo ($title); ?></title>
  <meta name="description" content="这是一个 help 页面">
  <meta name="keywords" content="help">
  <meta name="renderer" content="webkit">
  <meta http-equiv="Cache-Control" content="no-siteapp" /> 
  <meta name="apple-mobile-web-app-title" content="Amaze UI" />
  <link rel="stylesheet" type="text/css" href="/zxtms/Public/assets/css/amazeui.min.css" />
  <link rel="stylesheet" type="text/css" href="/zxtms/Public/assets/css/admin.css" />
  <script type="text/javascript" src="/zxtms/Public/assets/js/jquery.min.js"></script>
   <script type="text/javascript" src="/zxtms/Public/assets/js/amazeui.min.js"></script>
</head>
<body>
<style>
.am-active{
	background:#0E90D2 !important;
	color:#ffffff !important;
}
</style>
<header class="am-topbar am-topbar-inverse admin-header">
  <div class="am-topbar-brand">
    <strong>河南志信科技有限公司——</strong> <small>出差管理系统</small>
  </div>
  <button class="am-topbar-btn am-topbar-toggle am-btn am-btn-sm am-btn-success am-show-sm-only" data-am-collapse="{target: '#topbar-collapse'}"><span class="am-sr-only">导航切换</span> <span class="am-icon-bars"></span></button>
  <div class="am-collapse am-topbar-collapse" id="topbar-collapse">
    <ul class="am-nav am-nav-pills am-topbar-nav am-topbar-right admin-header-list">   
    <?php if(empty($_SESSION['name'])): ?><li><a href="<?php echo U('Login/login');?>"><span class="am-icon-user"></span> 登录</a></li>
    <?php else: ?>
        <li><a href=""><span class="am-icon-user"></span>  欢迎您：<?php echo (session('name')); ?></a></li> 
          <li><a href="<?php echo U('Login/logout');?>"><span class="am-icon-sign-out"></span>注销</a></li><?php endif; ?>                                    
    </ul>
  </div>
</header>

<div class="am-cf admin-main">
  <!-- sidebar start -->
  <div class="admin-sidebar am-offcanvas am-dh">
    <div class="am-offcanvas-bar admin-offcanvas-bar">    
      <ul class="am-list admin-sidebar-list" >
       <li><a <?php if(MODULE_NAME.'/'.CONTROLLER_NAME == 'Admin/Index'): ?>class="am-active"<?php endif; ?> href="<?php echo U('Admin/Index/index');?>"><span class="am-icon-home"></span> 首页</a></li>
        <li class="admin-parent">
          <a class="am-cf" data-am-collapse="{target: '#collapse-nav2'}"> 公司管理 <span class="am-icon-angle-right am-fr am-margin-right"></span></a>
          <ul class="am-list am-collapse admin-sidebar-sub am-in" id="collapse-nav2">
           <li><a <?php if(MODULE_NAME.'/'.CONTROLLER_NAME == 'Admin/Station'): ?>class="am-active"<?php endif; ?> href="<?php echo U('Admin/Station/View');?>" class="am-cf">公司岗位</a></li>
           <?php if(($_SESSION['uid']) == "1"): ?><li><a <?php if(MODULE_NAME.'/'.CONTROLLER_NAME == 'Admin/Staff'): ?>class="am-active"<?php endif; ?> href="<?php echo U('Admin/Staff/View');?>" class="am-cf">员工管理</a></li><?php endif; ?>
            <li><a <?php if(MODULE_NAME.'/'.CONTROLLER_NAME == 'Admin/Task'): ?>class="am-active"<?php endif; ?> href="<?php echo U('Admin/Task/View');?>" class="am-cf">出差管理</a></li>                   
            <li><a  href="<?php echo U('Admin/Rule/View');?>"> 出差统计</a></li>
            <li><a  href="<?php echo U('Admin/Rule/View');?>"> 请假管理</a></li>              
          </ul>
        </li>   
        <li class="admin-parent">
          <a class="am-cf" data-am-collapse="{target: '#collapse-nav'}"> 权限管理 <span class="am-icon-angle-right am-fr am-margin-right"></span></a>
          <ul class="am-list am-collapse admin-sidebar-sub am-in" id="collapse-nav">
            <li><a <?php if(MODULE_NAME.'/'.CONTROLLER_NAME == 'Admin/User'): ?>class="am-active"<?php endif; ?>  href="<?php echo U('Admin/User/View');?>" class="am-cf"> 系统管理人员</a></li>
            <li><a <?php if(MODULE_NAME.'/'.CONTROLLER_NAME == 'Admin/Group'): ?>class="am-active"<?php endif; ?> href="<?php echo U('Admin/Group/View');?>"> 角色管理</a></li>           
            <li><a <?php if(MODULE_NAME.'/'.CONTROLLER_NAME == 'Admin/Rule'): ?>class="am-active"<?php endif; ?> href="<?php echo U('Admin/Rule/View');?>"> 权限列表</a></li>                  
          </ul>
        </li>             
      </ul>
    </div>
  </div>
  <!-- sidebar end -->

  <!-- content start -->
  <div class="admin-content"> 
    <div class="admin-content-body">  
      <hr/>
     
<link rel="stylesheet" type="text/css" href="/zxtms/Public/assets/css/tp.css" />
<link rel="stylesheet" type="text/css" href="/zxtms/Public/assets/css/amazeui.datetimepicker.css" />
 <script type="text/javascript" src="/zxtms/Public/assets/js/amazeui.datetimepicker.min.js"></script> 
<style>
.am-table{
	font-size:13px;
}
.am-time{
	width:60%;
	height:30px;
}
</style>
<div class="am-g">
 <form class="am-form" method="post" > 
 
    <div class="am-form-group am-u-sm-6 am-u-end">
      <label for="doc-select-1">选择月份:</label>       
	   <select class="getid" name="id"  required ">      
        <?php if(is_array($monthlist)): $i = 0; $__LIST__ = $monthlist;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><option value="<?php echo ($vo["id"]); ?>" <?php if($vo["month"] == $nowmonth): ?>selected<?php endif; ?> ><?php echo ($vo["month"]); ?>月</option><?php endforeach; endif; else: echo "" ;endif; ?>
      </select>
      <span class="am-form-caret"></span>     				       	                 
    </div>
 
  <div class="am-u-sm-6 am-u-end">
    <label for="doc-select-1">收搜关键词:</label> 
    <div class="am-input-group">  
      <input type="text" class="am-form-field">       
      <span class="am-input-group-btn">
        <button  class="am-btn am-btn-default" type="button"><span class="am-icon-search"></span> </button>
      </span>   
    </div>
  </div>
</form>
</div>
<script type="text/javascript" src="/zxtms/Public/layer/layer.js"></script>
 <script type="text/javascript" src="/zxtms/Public/assets/js/jquery.min.js"></script>
<script>
$(function(){
$(".getid").change(function(){
	var value=$(".getid").val();
	$.ajax({
		url: "/zxtms/index.php/Admin/Task/month",
		type: "post",
		data:{"id":value},
		
		dataType: "json",
			beforeSend:function(){
				layer.msg('正在加载....', {
					  icon: 16
					  ,shade: 0.01
					});
			},
			success: function(data){
			if(data.state==1){
			location.href = "/zxtms/index.php/Admin/Task/Task_month";
			layer.msg(data.msg, {icon: 6});
			}else{
			layer.msg(data.msg, {icon: 5});
			}
			},
			error:function(){
				layer.msg('服务异常！');
			}
			
		});
}); 
	
}); 

</script>




<table class="am-table am-table-compact am-table-centered am-scrollable-horizontal   am-table-bordered">  
    <thead>
        <tr>
            <th>id</th>            
            <th>出差人</th> 
            <th>出差时间</th> 
            <th>回来时间</th>
            <th>出差天数</th> 
            <th>加班天数</th>
          <!--   <th>迟到次数</th> -->
            <th>状态</th>                             
            <th>操作</th>
        </tr>
    </thead>
    <tbody>
    <?php if(is_array($tasklist)): $i = 0; $__LIST__ = $tasklist;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><tr>
            <td colspan="9"><?php echo ($vo["month"]); ?>月份
             <?php if($vo["task"] == $null): ?><span style="color:red;">暂无出差记录</span><?php endif; ?>            
            </td>                       
        </tr>
      <?php if(is_array($vo)): $i = 0; $__LIST__ = $vo;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$v): $mod = ($i % 2 );++$i; if(is_array($v)): foreach($v as $key=>$vv): ?><tr>
            <td><?php echo ($key+1); ?></td>
            <td><?php echo ($vv["staff_name"]); ?></td>           
            <td><?php echo ($vv["taskstarttime"]); ?></td> 
            <td>
            <?php if($vv["taskendtime"] == '0000-00-00 00:00:00'): ?>还没有回来<?php else: echo ($vv["taskendtime"]); endif; ?>         
            </td> 
            <td>
            <?php if($vv["taskdate"] == '0'): ?>暂且不知道<?php else: echo ($vv["taskdate"]); ?>天<?php endif; ?>
            </td> 
            <td>
            <?php if($vv["taskadd"] == '0'): ?>无加班<?php else: echo ($vv["taskadd"]); ?>天<?php endif; ?>
            </td> 
          <!--   <td>
            <?php if($vv["task_late"] == '0'): ?>无<?php else: echo ($vv["task_late"]); endif; ?>
            </td>   -->
            <td><?php if($vv["taskstatus"] == '2'): ?>出差中<?php else: ?>出差完毕<?php endif; ?></td>                                      
            <td>
            <?php if(($vv["taskstatus"]) == "1"): ?><button class="am-btn am-btn-success am-btn-xs am-disabled">计算完毕</button>
            <button class="am-btn am-btn-warning am-btn-xs am-disabled" >删除</button>
            <?php else: ?>
            <a href="<?php echo U('Task/edit?id='.$vv['id']);?>">
            <button class="am-btn am-btn-primary am-btn-xs ">前去计算</button>
            </a>           
            <a onclick='return del("<?php echo ($vv["id"]); ?>")'>
            <button  class="am-btn am-btn-warning am-btn-xs }">删除</button>
            </a><?php endif; ?>          
            </td>
        </tr><?php endforeach; endif; endforeach; endif; else: echo "" ;endif; endforeach; endif; else: echo "" ;endif; ?>
    </tbody>
</table>
		 <!-- <div class="am-g am-text-center">
		      <?php echo ($page); ?>
			</div>  -->
	<div class="am-g">
       <a href="<?php echo U('Task/add');?>">
           <button class="am-btn am-btn-primary am-btn-sm "><?php echo ($info); ?></button>
        </a>
	</div>
	
	
 
<script type="text/javascript" src="/zxtms/Public/layer/layer.js"></script>
<script type="text/javascript">

function del(id){
	layer.confirm('您确定要删除这条数据吗？', {
	btn: ['确定','取消']
	}, function()
	{
	$.ajax({
	url: "/zxtms/index.php/Admin/Task/delete",
	type: "get",
	data:{"id":id},
	dataType: "json",
	beforeSend:function(){
		layer.msg('正在删除', {
			  icon: 16
			  ,shade: 0.01
			});
	},
	success: function(data){
	if(data.state==1){
	location.href = location.href;
	layer.msg(data.msg, {icon: 6});
	}else{
	layer.msg(data.msg, {icon: 5});
	}
	},
	error:function(){
		layer.msg('服务异常！');
	}
	
	});


	});
	}
	

</script> 	 
        
      

 </div>
    <footer class="admin-content-footer">
      <hr>
      <p class="am-padding-left">© 2014 AllMobilize, Inc. Licensed under MIT license.</p>
    </footer>
  </div>
  <!-- content end -->




</div>



</body>
</html>